/**
 * 
 */
package net.sf.rose.web;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;
import org.springframework.web.servlet.HandlerExceptionResolver;
import org.springframework.web.servlet.ModelAndView;

/**
 * @author fengjian
 * @since 2013-5-9
 */
public class ExceptionHandler implements HandlerExceptionResolver {

	private Logger log = Logger.getLogger(ExceptionHandler.class);
	
	@Override   
    public ModelAndView resolveException(HttpServletRequest request,    
    									 HttpServletResponse response, 
    									 Object handler, 
    									 Exception e) {
		log.error("发生未捕获的异常！", e);
		ModelAndView m = new ModelAndView("failure");
		m.addObject("exception", e);
        return m;
    }

}
